package com.dream.algoritm;

import java.util.*;

public class Test1 {

    public static void main(String[] args) {
        int[] a = new int[]{5, 3, 1, 5, 4};
        int[] b = new int[]{5, 3};

        System.out.println(process(a, b));
    }

    public static List<Integer> process(int[] a, int[] b) {

        List<Integer> res = new ArrayList<>();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < b.length; i++) {
            set.add(b[i]);
        }

        for (int j = 0; j < a.length; j++) {
            if (set.contains(a[j])) {
                res.add(j);
            }
        }

        return res;
    }
}
